<template>
  <div class="app-container">
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="multiple"
          @click="handleOpenScreenAll"
          >亮屏</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="multiple"
          @click="handleCloseScreenAll"
          >息屏</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="multiple"
          @click="handleBatchRestart"
          >重启</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="multiple"
          @click="handleBatchPowerOff"
          >关机</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="multiple"
          @click="handleBatchOpsOn"
          >开启PC</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="multiple"
          @click="handleBatchOpsOff"
          >关闭PC</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="multiple"
          @click="handleBatchMute"
          >静音</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="multiple"
          @click="handleBatchUnMute"
          >解除静音</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-select v-model="source" placeholder="请选择">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
        <el-button @click="handleSource">切换信号源</el-button>
      </el-col>

      <el-col :span="1.5">
        <el-input
          width="50"
          v-model="voice"
          :style="{ width: '200px' }"
          placeholder="请输入音量"
          clearable
          @keyup.enter.native="handleQuery"
        />
        <el-button @click="handleVoice">修改音量</el-button>
      </el-col>

      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>

    <el-table
      ref="product"
      v-loading="loading"
      :data="smartList"
      row-key="id"
      :tree-props="{ children: 'children' }"
      border
      default-expand-all
      style="width: 100%"
      @selection-change="handleSelectionChange"
      @select="selectFun"
      @select-all="selectAllFun"
      :row-class-name="rowClassNameFun"
      :header-row-class-name="headerRowClassName"
      :span-method="arraySpanMethod"
    >
      <el-table-column type="selection"   width="55" align="center" />
      <!-- 部门名称 -->
      <el-table-column label="部门名称" align="center" width="200" prop="deptName" />
      <el-table-column label="设备名称" align="center" prop="deviceName" />
      <el-table-column label="设备编号" align="center" prop="deviceNo" />
      <el-table-column label="在线状态" align="center" prop="online">
        <template slot-scope="scope" v-if="scope.row.deviceNo">
          <span :style="{ color: scope.row.online ? 'green' : 'red' }">
            {{ scope.row.online ? "在线" : "离线" }}
          </span>
        </template>
      </el-table-column>
      <el-table-column label="屏幕状态" align="center" prop="screenStatus">
        <template slot-scope="scope">
          <el-switch
            v-model="scope.row.screenStatus"
            :active-value="true"
            :inactive-value="false"
            v-if="scope.row.deviceNo"
            @change="handlescreenStatusChange(scope.row)"
          ></el-switch>
        </template>
      </el-table-column>
      <el-table-column label="电脑状态" align="center" prop="opsStatus">
        <template slot-scope="scope">
          <el-switch
            v-model="scope.row.opsStatus"
            :active-value="true"
            :inactive-value="false"
            v-if="scope.row.deviceNo"
            @change="handleopsStatusChange(scope.row)"
          ></el-switch>
        </template>
      </el-table-column>
      <el-table-column label="静音状态" align="center" prop="muteStatus">
        <template slot-scope="scope">
          <el-switch
            v-model="scope.row.muteStatus"
            :active-value="true"
            :inactive-value="false"
            v-if="scope.row.deviceNo"
            @change="handlemuteStatusChange(scope.row)"
          ></el-switch>
        </template>
      </el-table-column>
      <el-table-column label="音量大小" align="center" prop="voice" />
      <el-table-column label="信号源" align="center" prop="source" />
      <el-table-column label="注册时间" align="center" prop="createTime" />
      <el-table-column label="上次心跳时间" align="center" prop="upTime" />
      <el-table-column
        label="操作"
        width="400"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            key="jwrowrwqreoqwri"
            v-if="scope.row.deviceNo"
            @click="handleDtp(scope.row)"
            >指定部门</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            v-if="scope.row.deviceNo&&scope.row.online"
            @click="handleUpdateSource(scope.row)"
            >切换信号源</el-button
          >

          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            v-if="scope.row.deviceNo&&scope.row.online"
            @click="handleUpdateVoice(scope.row)"
            >修改音量</el-button
          >

          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            v-if="scope.row.deviceNo&&scope.row.online"
            @click="handleRestart(scope.row)"
            >重启</el-button
          >

          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            v-if="scope.row.deviceNo&&scope.row.online"
            @click="handleCloseSmart(scope.row)"
            >关机</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <!-- 添加或修改公告对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="780px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-row>
          <el-col :span="12">
            <el-form-item v-if="sourceFlag" label="切换信号" prop="source">
              <el-select v-model="form.source" placeholder="请选择">
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>

            <el-form-item v-if="voiceFlag" label="音量" prop="voice">
              <el-input v-model="form.voice" placeholder="请输入音量" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog title="指定部门" :visible.sync="visibleDtp" width="300px">
      <el-form
        ref="formDtp"
        :model="formDtp"
        :rules="rulesDtp"
        label-width="80px"
      >
        <el-form-item label="归属部门" prop="deptId">
          <treeselect
            v-model="formDtp.deptId"
            :options="deptOptions"
            :show-count="true"
            placeholder="请选择归属部门"
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormDtp">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

  <script>
import {
  batchMute,
  batchOpsOn,
  batchPowerOff,
  batchRestart,
  batchUnMute,
  batchVoice,
  closeScreenAll,
  openScreenAll,
  smartScreenList,
  updateSourceALl,
  updateStatus,
  deptTree,
  udpateDept,
} from "@/api/system/operationSmart.js";
import { changeUserStatus } from "@/api/system/user";
import Treeselect from "@riophae/vue-treeselect";
import { addNotice, getNotice, updateNotice } from "@/api/system/notice";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";

export default {
  name: "Loan",
  components: { Treeselect },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 音量输入框
      voiceFlag: false,
      sourceFlag: false,
      // 选中数组
      deviceNos: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 公司管理表格数据
      smartList: [],
      // 日期范围
      dateRange: [],
      // 总借款未还信息
      allLoanMoney: {},
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        name: null,
        borrower: null,
        dateRange: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
      source: null,
      voice: null,
      options: [
        { value: "ANDROID", label: "ANDROID" },
        { value: "HDMI1", label: "HDMI1" },
        { value: "VGA1", label: "VGA1" },
        { value: "PC", label: "PC" },
      ],
      deptOptions: null,
      visibleDtp: false,
      formDtp: {},
      rulesDtp: {},
      dtpRow: null,
    };
  },
  created() {
    this.getList();
    this.getDeptTree();
  },
  methods: {
    /** 查询公司管理列表 */
    getList() {
      this.loading = true;
      smartScreenList(this.queryParams).then((response) => {
        this.smartList = this.handleTree(response.data, "id");
        // console.log("===========1111111", this.smartList,response.data);
        this.loading = false;
        // this.smartList=[{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1},{"deviceName":1}]
      });
    },
    /** 查询部门下拉树结构 */
    getDeptTree() {
      deptTree().then((response) => {
        this.deptOptions = response.data;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.visibleDtp = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        deviceNo: null,
        source: null,
        voice: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 批量修改信号源
    handleSource() {
      const list = this.deviceNos;
      const data = {
        source: this.source,
        deviceNos: list,
      };
      this.loading = true;
      console.log("wwww", data);
      updateSourceALl(data).then((res) => {
        this.$modal.msgSuccess("在线设备修改信号源成功");
        this.getList();
        this.loading = false;
      });
    },
    // 批量修改音量
    handleVoice() {
      const list = this.deviceNos;
      const data = {
        voice: this.voice,
        deviceNos: list,
      };
      this.loading = true;
      console.log("wwww", data);
      batchVoice(data).then((res) => {
        this.$modal.msgSuccess("在线设备修改音量成功");
        this.getList();
        this.loading = false;
      });
    },
    // 批量亮屏
    handleOpenScreenAll() {
      const list = this.deviceNos;
      console.log("list", list);
      const data = {
        deviceNos: list,
      };
      this.loading = true;
      this.$modal
        .confirm("确认要亮屏吗？")
        .then(function () {
          return openScreenAll(data);
        })
        .then(() => {
          this.$modal.msgSuccess("在线设备操作成功");
          this.getList();
          this.loading = false;
        });
    },
    // 批量息屏
    handleCloseScreenAll() {
      const list = this.deviceNos;
      console.log("list", list);
      const data = {
        deviceNos: list,
      };
      this.loading = true;
      this.$modal
        .confirm("确认要息屏吗？")
        .then(function () {
          return closeScreenAll(data);
        })
        .then(() => {
          this.$modal.msgSuccess("在线设备操作成功");
          this.getList();
          this.loading = false;
        });
    },
    // 批量重启
    handleBatchRestart() {
      const list = this.deviceNos;
      console.log("list", list);
      const data = {
        deviceNos: list,
      };
      this.loading = true;
      this.$modal
        .confirm("确认要重启智慧屏吗？")
        .then(function () {
          return batchRestart(data);
        })
        .then(() => {
          this.$modal.msgSuccess("在线设备操作成功");
          this.getList();
          this.loading = false;
        });
    },
    // 批量关机
    handleBatchPowerOff() {
      const list = this.deviceNos;
      console.log("list", list);
      const data = {
        deviceNos: list,
      };
      this.loading = true;
      this.$modal
        .confirm("确认要关机吗？")
        .then(function () {
          return batchPowerOff(data);
        })
        .then(() => {
          this.$modal.msgSuccess("在线设备操作成功");
          this.getList();
          this.loading = false;
        });
    },
    // 批量开启PC
    handleBatchOpsOn() {
      const list = this.deviceNos;
      console.log("list", list);
      const data = {
        deviceNos: list,
      };
      this.loading = true;
      this.$modal
        .confirm("确认要开启PC吗？")
        .then(function () {
          return batchOpsOn(data);
        })
        .then(() => {
          this.$modal.msgSuccess("在线设备操作成功");
          this.getList();
          this.loading = false;
        });
    },
    // 批量关闭PC
    handleBatchOpsOff() {
      const list = this.deviceNos;
      console.log("list", list);
      const data = {
        deviceNos: list,
      };
      this.loading = true;
      this.$modal
        .confirm("确认要关闭PC吗？")
        .then(function () {
          return batchOpsOff(data);
        })
        .then(() => {
          this.$modal.msgSuccess("在线设备操作成功");
          this.getList();
          this.loading = false;
        });
    },
    // 批量静音
    handleBatchMute() {
      const list = this.deviceNos;
      console.log("list", list);
      const data = {
        deviceNos: list,
      };
      this.loading = true;
      this.$modal
        .confirm("确认要静音吗？")
        .then(function () {
          return batchMute(data);
        })
        .then(() => {
          this.$modal.msgSuccess("在线设备操作成功");
          this.getList();
          this.loading = false;
        });
    },
    //批量解除静音
    handleBatchUnMute() {
      const list = this.deviceNos;
      console.log("list", list);
      const data = {
        deviceNos: list,
      };
      this.loading = true;
      this.$modal
        .confirm("确认要解除静音吗？")
        .then(function () {
          return batchUnMute(data);
        })
        .then(() => {
          this.$modal.msgSuccess("在线设备操作成功");
          this.getList();
          this.loading = false;
        });
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      // this.row = selection
      this.setDevice(selection)
      // console.log("======1ppppppppp", this.deviceNos, selection);
      this.single = selection.length !== 1;
      // this.multiple = !selection.length;
      this.multiple = !selection.some((item) => item.isSelect);
    },
    setDevice(list){
      list.forEach(item =>{
        if(item.isSelect&&item.deviceNo){
          if(this.deviceNos.some(device=>device===item.deviceNo))return
          this.deviceNos.push(item.deviceNo)
        }
        if(item.children&&item.children.length){
          this.setDevice(item.children)
        }
      })
    },

    selectable(row, index){
      return row.online||row.deviceNo== null || row.deviceNo == '';
    },


    // 修改电脑状态
    handleopsStatusChange(row) {
      let text = row.opsStatus === true ? "开启" : "关闭";
      this.$modal
        .confirm('确认要"' + text + '""' + row.deviceNo + '"智慧屏PC吗？')
        .then(function () {
          const deviceNo = row.deviceNo;
          const opsStatus = row.opsStatus;
          const data = { deviceNo, opsStatus };
          return updateStatus(data);
        })
        .then(() => {
          this.$modal.msgSuccess(text + "成功");
        })
        .catch(function () {
          row.opsStatus = row.opsStatus === "0" ? "1" : "0";
        });
    },

    // 修改屏幕状态
    handlescreenStatusChange(row) {
      let text = row.screenStatus === true ? "亮屏" : "息屏";
      this.$modal
        .confirm('确认要"' + text + '""' + row.deviceNo + '"智慧屏吗？')
        .then(function () {
          const deviceNo = row.deviceNo;
          const screenStatus = row.screenStatus;
          const data = { deviceNo, screenStatus };
          return updateStatus(data);
        })
        .then(() => {
          this.$modal.msgSuccess(text + "成功");
        })
        .catch(function () {
          row.screenStatus = row.screenStatus === true ? false : true;
        });
    },
    // 重启
    handleRestart(row) {
      this.$modal
        .confirm("确认要重启" + row.deviceNo + '"智慧屏吗？')
        .then(function () {
          const deviceNo = row.deviceNo;
          const restart = true;
          const data = { deviceNo, restart };
          return updateStatus(data);
        })
        .then(() => {
          this.$modal.msgSuccess(text + "成功");
        })
        .catch(function () {
          row.status = row.status === true ? false : true;
        });
    },
    // 关机
    handleCloseSmart(row) {
      this.$modal
        .confirm("确认要关机" + row.deviceNo + '"智慧屏吗？')
        .then(function () {
          const deviceNo = row.deviceNo;
          const powerStatus = true;
          const data = { deviceNo, powerStatus };
          return updateStatus(data);
        })
        .then(() => {
          this.$modal.msgSuccess(text + "成功");
        })
        .catch(function () {
          row.status = row.status === true ? false : true;
        });
    },

    /** 单个修改信号源按钮操作 */
    handleUpdateSource(row) {
      this.reset();
      this.sourceFlag = true;
      this.voiceFlag = false;
      this.form.deviceNo = row.deviceNo;
      this.form.source = row.source;
      this.open = true;
      this.title = "修改信号源";
    },
    handleDtp(row) {
      this.visibleDtp = true;
      this.dtpRow = row;
    },
    /** 修改音量按钮操作 */
    handleUpdateVoice(row) {
      this.reset();
      this.sourceFlag = false;
      this.voiceFlag = true;
      this.form.deviceNo = row.deviceNo;
      this.form.voice = row.voice;
      this.open = true;
      this.title = "修改音量";
    },
    /** 提交按钮 */
    submitForm: function () {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.deviceNo != undefined) {
            updateStatus(this.form).then((res) => {
              this.$modal.msgSuccess("修改信号源成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    submitFormDtp() {
      const data = {
        deviceNo: this.dtpRow.deviceNo,
        ...this.formDtp,
      };
      udpateDept(data).then((res) => {
        this.$modal.msgSuccess("指定部门成功");
        this.visibleDtp = false;
        this.getList();
      });
    },

    // 修改静音状态
    handlemuteStatusChange(row) {
      let text = row.muteStatus === true ? "静音" : "解除静音";
      this.$modal
        .confirm('确认要"' + text + '""' + row.deviceNo + '"智慧屏吗？')
        .then(function () {
          const deviceNo = row.deviceNo;
          const muteStatus = row.muteStatus;
          const data = { deviceNo, muteStatus };
          return updateStatus(data);
        })
        .then(() => {
          this.$modal.msgSuccess(text + "成功");
        })
        .catch(function () {
          row.muteStatus = row.muteStatus === true ? false : true;
        });
    },
    selectFun(selection, row) {
      this.setRowIsSelect(row);
    },
    checkIsAllSelect() {
      this.oneProductIsSelect = [];
      this.smartList.forEach((item) => {
        this.oneProductIsSelect.push(item.isSelect);
      });
      // 判断一级产品是否是全选.如果一级产品全为true，则设置为取消全选，否则全选
      const isAllSelect = this.oneProductIsSelect.every((selectStatusItem) => {
        return selectStatusItem == true;
      });
      return isAllSelect;
    },
    selectAllFun(selection) {
      const isAllSelect = this.checkIsAllSelect();
      this.smartList.forEach((item) => {
        item.isSelect = isAllSelect;
        this.$refs.product.toggleRowSelection(item, !isAllSelect);
        this.selectFun(selection, item);
      });
    },
    rowClassNameFun({ row }) {
      if (row.isSelect === "") {
        return "indeterminate";
      }
    },
    headerRowClassName({ row }) {
      // console.log('row: ', row)
      const oneProductIsSelect = [];
      this.smartList.forEach((item) => {
        oneProductIsSelect.push(item.isSelect);
      });
      if (oneProductIsSelect.includes("")) {
        return "indeterminate";
      }
      return "";
    },
    setRowIsSelect(row) {
      // 当点击父级点复选框时，当前的状态可能为未知状态，所以当前行状态设为false并选中，即可实现子级点全选效果
      if (row.isSelect === "") {
        row.isSelect = false;
        this.$refs.product.toggleRowSelection(row, true);
      }
      row.isSelect = !row.isSelect;
      const that = this;

      function selectAllChildrens(data) {
        data.forEach((item) => {
          item.isSelect = row.isSelect;
          that.$refs.product.toggleRowSelection(item, row.isSelect);
          if (item.children && item.children.length) {
            selectAllChildrens(item.children);
          }
        });
      }

      function getSelectStatus(selectStatuaArr, data) {
        if (!data || !data.length) return;
        data.forEach((childrenItem) => {
          selectStatuaArr.push(childrenItem.isSelect);
          if (childrenItem.children && childrenItem.children.length) {
            getSelectStatus(selectStatuaArr, childrenItem.children);
          }
        });
        return selectStatuaArr;
      }
      function getLevelStatus(row) {
        // 如果当前节点的parantId =0 并且有子节点，则为1
        // 如果当前节点的parantId !=0 并且子节点没有子节点 则为3
        if (row.parentId == 0) {
          if (row.children && row.children.length) {
            return 1;
          } else {
            return 4;
          }
        } else {
          if (!row.children || !row.children.length) {
            return 3;
          } else {
            return 2;
          }
        }
      }
      let result = {};
      // 获取明确的节点
      function getExplicitNode(data, parentId) {
        data.forEach((item) => {
          if (item.id == parentId) {
            result = item;
          }
          if (item.children && item.children.length) {
            getExplicitNode(item.children, parentId);
          }
        });
        return result;
      }
      function operateLastLeve(row) {
        // 操作的是子节点  1、获取父节点  2、判断子节点选中个数，如果全部选中则父节点设为选中状态，如果都不选中，则为不选中状态，如果部分选择，则设为不明确状态
        let selectStatuaArr = [];
        const item = getExplicitNode(that.smartList, row.parentId);
        selectStatuaArr = getSelectStatus(selectStatuaArr, item.children);
        if (
          selectStatuaArr.every((selectItem) => {
            return selectItem == true;
          })
        ) {
          item.isSelect = true;
          that.$refs.product.toggleRowSelection(item, true);
        } else if (
          selectStatuaArr.every((selectItem) => {
            return selectItem == false;
          })
        ) {
          item.isSelect = false;
          that.$refs.product.toggleRowSelection(item, false);
        } else {
          item.isSelect = "";
        }
        // 则还有父级
        if (item.parentId != 0) {
          operateLastLeve(item);
        }
      }
      // 判断操作的是子级点复选框还是父级点复选框，如果是父级点，则控制子级点的全选和不全选

      // 1、只是父级 2、既是子集，又是父级 3、只是子级
      const levelSataus = getLevelStatus(row);
      if (levelSataus == 1) {
        selectAllChildrens(row.children);
      } else if (levelSataus == 2) {
        selectAllChildrens(row.children);
        operateLastLeve(row);
      } else if (levelSataus == 3) {
        operateLastLeve(row);
      }
    },
    arraySpanMethod({ row, column, rowIndex, columnIndex }) {
      if (columnIndex > 1) {
        if (!row.deviceNo) {
          if (columnIndex < 11) {
            return [0,0];
          }
           else {
            return [1, 10];
          }
        }
      }
    },
  },
};
</script>

  <style scoped lang=scss>
/* 调整展开按钮的大小 */
.custom-expand-table ::v-deep .el-table__expand-icon {
  font-size: 16px; /* 调整图标大小 */
  width: 30px; /* 调整按钮宽度 */
  height: 30px; /* 调整按钮高度 */
  line-height: 30px; /* 垂直居中 */
}

/* 调整展开按钮的 hover 效果 */
.custom-expand-table ::v-deep .el-table__expand-icon:hover {
  background-color: #f5f7fa; /* 背景色 */
  border-radius: 50%; /* 圆形按钮 */
}
.indeterminate .el-checkbox__input .el-checkbox__inner {
  background-color: #2da186 !important;
  border-color: #2da186 !important;
  color: #fff !important;
}

.indeterminate .el-checkbox__input.is-checked .el-checkbox__inner::after {
  transform: scale(0.5);
}

.indeterminate .el-checkbox__input .el-checkbox__inner {
  background-color: #f2f6fc;
  border-color: #dcdfe6;
}
.indeterminate .el-checkbox__input .el-checkbox__inner::after {
  border-color: #c0c4cc !important;
  background-color: #c0c4cc;
}
.product-show th .el-checkbox__inner {
  display: none !important;
}

.indeterminate .el-checkbox__input .el-checkbox__inner::after {
  content: "";
  position: absolute;
  display: block;
  background-color: #fff;
  height: 2px;
  transform: scale(0.5);
  left: 0;
  right: 0;
  top: 5px;
  width: auto !important;
}
.product-show .el-checkbox__inner {
  display: block !important;
}

.product-show .el-checkbox {
  display: block !important;
}
</style>
